<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Links</title>
</h:head>
<h:body>
	<ui:composition template="/WEB-INF/templates/template.xhtml">
		<ui:define name="title">
		Links
	</ui:define>
		<ui:define name="content">
			<h:form>
				<table>
					<tr>
						<td><h:outputLabel for="link" value="Link" /></td>
						<td><p:inputText id="link" value="#{linkBean.link.linktext}">
								<f:validator validatorId="CustomUrlValidator" />
							</p:inputText></td>
					</tr>
					<tr>
						<td><h:outputLabel for="description" value="Beschreibung" /></td>
						<td><p:inputText id="description"
								value="#{linkBean.link.description}" /></td>
					</tr>
					<tr>
						<td rowspan="2"><p:commandButton id="save" value="Speichern"
								action="#{linkBean.save}" ajax="false" /></td>
					</tr>
				</table>
			</h:form>
			<h:form>
				<p:growl id="growl" />
				<!-- Liste der Links: Anzeige der erfassten Links -->
				<div>
					<p:commandButton action="#{navigationBean.SYNC()}"
						value="Synchronisieren" ajax="false" />
				</div>
				<p:dataTable id="users" value="#{linkBean.allLinks}"
					var="linkBeanLink">

					<!-- Kopfbereich: Name der Liste -->
					<f:facet name="header">
							Erfasste Links
						</f:facet>
					<!-- Kolonne 1: Link -->
					<p:column ajax="true" immediate="true">
						<f:facet name="header">
							<h:outputText value="Link" />
						</f:facet>
						<h:outputLink value="#{linkBeanLink.linktext}">#{linkBeanLink.linktext}</h:outputLink>
					</p:column>
					<!-- Kolonne 2: Link Beschreibung -->
					<p:column ajax="true" immediate="true">
						<f:facet name="header">
							<h:outputText value="Beschreibung" />
						</f:facet>
						<h:outputText value="#{linkBeanLink.description}" />
					</p:column>
					<!-- Kolonne 9: Benutzeraktionen als ICONS -->
					<p:column style="text-align:center">
						<f:facet name="header">
							<h:outputText value="Links verwalten" />
						</f:facet>
						<h:panelGroup style="white-space: nowrap">
							<p:commandButton icon="ui-icon-trash" title="Link löschen"
								actionListener="#{linkBean.deleteLink(linkBeanLink)}"
								ajax="false" immediate="true" />
							<p:commandButton icon="ui-icon-pencil" title="Link bearbeiten"
								actionListener="#{linkBean.editLink(linkBeanLink)}" ajax="false"
								immediate="true">
							</p:commandButton>
						</h:panelGroup>
					</p:column>
				</p:dataTable>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>